import VueRouter from 'vue-router';
//导入测试组件
import Test from './Test';
//导入tabbar子组件
import HomeContainer from './components/tabbar/HomeContainer';
import MemberContainer from './components/tabbar/MemberContainer';
import ShopcarContainer from './components/tabbar/ShopcarContainer';
import SearchContainer from './components/tabbar/UserContainer';
import NewsList from './components/news/NewsList';
import NewsInfo from './components/news/NewsInfo';
import PhotoList from './components/photos/PhotoList';
import PhotoInfo from './components/photos/PhotoInfo';
import GoodsList from './components/goods/GoodsList';
import GoodsInfo from './components/goods/GoodsInfo';
import GoodsDesc from './components/goods/GoodsDesc';
import GoodsComment from './components/goods/GoodsComment';
//用户登录
import Login from './components/userHandle/Login';
import Register from './components/userHandle/Register';

//创建路由对象
let router = new VueRouter({
    routes: [ //配置路由规则
        { path: '/Test', component: Test }, //测试组件
        { path: '/', redirect: '/home' },
        {
            path: '/home',
            name: 'home',
            component: HomeContainer,
            meta: {
                title: '首页',
                index: 1,
            },
        },
        {
            path: '/member',
            name: 'member',
            component: MemberContainer,
            meta: {
                title: '会员',
                index: 2,
            },
        },
        {
            path: '/shopcar',
            name: 'shopcar',
            component: ShopcarContainer,
            meta: {
                title: '购物车',
                index: 3,
            },
        },
        {
            path: '/search',
            name: 'search',
            component: SearchContainer,
            meta: {
                title: '搜索',
                index: 4,
            },
        },
        {
            path: '/home/newsList',
            name: 'newsList',
            component: NewsList,
            meta: {
                title: '新闻列表',
            },
        },
        {
            path: '/home/news/newsInfo/:id',
            component: NewsInfo,
            meta: {
                title: '新闻详情',
            },
        },
        {
            path: '/home/photoList',
            component: PhotoList,
            meta: {
                title: '图片列表',
            },
        },
        {
            path: '/home/photoList/photoInfo/:id',
            component: PhotoInfo,
            meta: {
                title: '图片详情',
            },
        },
        {
            path: '/home/goods/goodsList',
            component: GoodsList,
            meta: {
                title: '商品列表',
            },
        },
        {
            path: '/home/goods/goodsInfo/:id',
            component: GoodsInfo,
            name: 'goodsInfo',
            meta: {
                title: '商品详情',
            },
        },
        {
            path: '/home/goods/goodsDesc/:id',
            component: GoodsDesc,
            name: 'goodsDesc',
            meta: {
                title: '商品描述',
            },
        },
        {
            path: '/home/goods/goodsComment/:id',
            component: GoodsComment,
            name: 'goodsComment',
            meta: {
                title: '商品评论',
            },
        },
        {
            path: '/home/user/login',
            component: Login,
            name: 'login',
            meta: {
                title: '登录',
            },
        },
        {
            path: '/home/user/register',
            component: Register,
            name: 'register',
            meta: {
                title: '注册',
            },
        },
    ],
    linkActiveClass: 'mui-active', //覆盖默认路由高亮的类（router-link-active）
});

//向外暴露路由
export default router;
